package WrittenTest;

import java.util.*;

public class test35 {
    // 添加字符
    // 算法原理：滑动窗口
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 处理输入
        String str1 = in.next(), str2 = in.next();
        // tmp来枚举出str1在str2中不同位置相同字符的最大数量
        int tmp = str2.length() - str1.length(), max = -1;
        while (tmp != -1) {
            // 每次循环需要清空变量，所以要放在while()里面
            int j = tmp, count = 0;
            for (int i = 0; i < str1.length(); i++) {
                if (str1.charAt(i) == str2.charAt(j)) count++;
                j++;
            }
            // max存储相同字符的最大值
            max = Math.max(max, count + (str2.length() - str1.length()));
            tmp--;
        }
        // 处理输出
        System.out.println(str2.length() - max);
    }
}
